\(\int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx\) [872]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [F(-1)]
   Sympy [F]
   Maxima [F(-2)]
   Giac [F(-2)]
   Mupad [F(-1)]

Optimal result

Integrand size = 29, antiderivative size = 176 \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\frac {g^2 \sqrt {a+b x+c x^2}}{c e}+\frac {g (4 c e f-2 c d g-b e g) \text {arctanh}\left (\frac {b+2 c x}{2 \sqrt {c} \sqrt {a+b x+c x^2}}\right )}{2 c^{3/2} e^2}+\frac {(e f-d g)^2 \text {arctanh}\left (\frac {b d-2 a e+(2 c d-b e) x}{2 \sqrt {c d^2-b d e+a e^2} \sqrt {a+b x+c x^2}}\right )}{e^2 \sqrt {c d^2-b d e+a e^2}} \]

[Out]

1/2*g*(-b*e*g-2*c*d*g+4*c*e*f)*arctanh(1/2*(2*c*x+b)/c^(1/2)/(c*x^2+b*x+a)^(1/2))/c^(3/2)/e^2+(-d*g+e*f)^2*arc
tanh(1/2*(b*d-2*a*e+(-b*e+2*c*d)*x)/(a*e^2-b*d*e+c*d^2)^(1/2)/(c*x^2+b*x+a)^(1/2))/e^2/(a*e^2-b*d*e+c*d^2)^(1/
2)+g^2*(c*x^2+b*x+a)^(1/2)/c/e

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {1667, 857, 635, 212, 738} \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\frac {g \text {arctanh}\left (\frac {b+2 c x}{2 \sqrt {c} \sqrt {a+b x+c x^2}}\right ) (-b e g-2 c d g+4 c e f)}{2 c^{3/2} e^2}+\frac {(e f-d g)^2 \text {arctanh}\left (\frac {-2 a e+x (2 c d-b e)+b d}{2 \sqrt {a+b x+c x^2} \sqrt {a e^2-b d e+c d^2}}\right )}{e^2 \sqrt {a e^2-b d e+c d^2}}+\frac {g^2 \sqrt {a+b x+c x^2}}{c e} \]

[In]

Int[(f + g*x)^2/((d + e*x)*Sqrt[a + b*x + c*x^2]),x]

[Out]

(g^2*Sqrt[a + b*x + c*x^2])/(c*e) + (g*(4*c*e*f - 2*c*d*g - b*e*g)*ArcTanh[(b + 2*c*x)/(2*Sqrt[c]*Sqrt[a + b*x
 + c*x^2])])/(2*c^(3/2)*e^2) + ((e*f - d*g)^2*ArcTanh[(b*d - 2*a*e + (2*c*d - b*e)*x)/(2*Sqrt[c*d^2 - b*d*e +
a*e^2]*Sqrt[a + b*x + c*x^2])])/(e^2*Sqrt[c*d^2 - b*d*e + a*e^2])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 635

Int[1/Sqrt[(a_) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Dist[2, Subst[Int[1/(4*c - x^2), x], x, (b + 2*c*x)
/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 738

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Symbol] :> Dist[-2, Subst[Int[1/(4*c*d
^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, (2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a,
b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[2*c*d - b*e, 0]

Rule 857

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Dis
t[g/e, Int[(d + e*x)^(m + 1)*(a + b*x + c*x^2)^p, x], x] + Dist[(e*f - d*g)/e, Int[(d + e*x)^m*(a + b*x + c*x^
2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0]
&&  !IGtQ[m, 0]

Rule 1667

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{q = Expon[Pq
, x], f = Coeff[Pq, x, Expon[Pq, x]]}, Simp[f*(d + e*x)^(m + q - 1)*((a + b*x + c*x^2)^(p + 1)/(c*e^(q - 1)*(m
 + q + 2*p + 1))), x] + Dist[1/(c*e^q*(m + q + 2*p + 1)), Int[(d + e*x)^m*(a + b*x + c*x^2)^p*ExpandToSum[c*e^
q*(m + q + 2*p + 1)*Pq - c*f*(m + q + 2*p + 1)*(d + e*x)^q - f*(d + e*x)^(q - 2)*(b*d*e*(p + 1) + a*e^2*(m + q
 - 1) - c*d^2*(m + q + 2*p + 1) - e*(2*c*d - b*e)*(m + q + p)*x), x], x], x] /; GtQ[q, 1] && NeQ[m + q + 2*p +
 1, 0]] /; FreeQ[{a, b, c, d, e, m, p}, x] && PolyQ[Pq, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2
, 0] &&  !(IGtQ[m, 0] && RationalQ[a, b, c, d, e] && (IntegerQ[p] || ILtQ[p + 1/2, 0]))

Rubi steps \begin{align*} \text {integral}& = \frac {g^2 \sqrt {a+b x+c x^2}}{c e}+\frac {\int \frac {\frac {1}{2} e \left (2 c e f^2-b d g^2\right )+\frac {1}{2} e g (4 c e f-2 c d g-b e g) x}{(d+e x) \sqrt {a+b x+c x^2}} \, dx}{c e^2} \\ & = \frac {g^2 \sqrt {a+b x+c x^2}}{c e}+\frac {(e f-d g)^2 \int \frac {1}{(d+e x) \sqrt {a+b x+c x^2}} \, dx}{e^2}+\frac {(g (4 c e f-2 c d g-b e g)) \int \frac {1}{\sqrt {a+b x+c x^2}} \, dx}{2 c e^2} \\ & = \frac {g^2 \sqrt {a+b x+c x^2}}{c e}-\frac {\left (2 (e f-d g)^2\right ) \text {Subst}\left (\int \frac {1}{4 c d^2-4 b d e+4 a e^2-x^2} \, dx,x,\frac {-b d+2 a e-(2 c d-b e) x}{\sqrt {a+b x+c x^2}}\right )}{e^2}+\frac {(g (4 c e f-2 c d g-b e g)) \text {Subst}\left (\int \frac {1}{4 c-x^2} \, dx,x,\frac {b+2 c x}{\sqrt {a+b x+c x^2}}\right )}{c e^2} \\ & = \frac {g^2 \sqrt {a+b x+c x^2}}{c e}+\frac {g (4 c e f-2 c d g-b e g) \tanh ^{-1}\left (\frac {b+2 c x}{2 \sqrt {c} \sqrt {a+b x+c x^2}}\right )}{2 c^{3/2} e^2}+\frac {(e f-d g)^2 \tanh ^{-1}\left (\frac {b d-2 a e+(2 c d-b e) x}{2 \sqrt {c d^2-b d e+a e^2} \sqrt {a+b x+c x^2}}\right )}{e^2 \sqrt {c d^2-b d e+a e^2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.70 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.05 \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\frac {\frac {2 e g^2 \sqrt {a+x (b+c x)}}{c}+\frac {4 \sqrt {-c d^2+b d e-a e^2} (e f-d g)^2 \arctan \left (\frac {\sqrt {c} (d+e x)-e \sqrt {a+x (b+c x)}}{\sqrt {-c d^2+e (b d-a e)}}\right )}{c d^2+e (-b d+a e)}-\frac {g (-4 c e f+2 c d g+b e g) \text {arctanh}\left (\frac {b+2 c x}{2 \sqrt {c} \sqrt {a+x (b+c x)}}\right )}{c^{3/2}}}{2 e^2} \]

[In]

Integrate[(f + g*x)^2/((d + e*x)*Sqrt[a + b*x + c*x^2]),x]

[Out]

((2*e*g^2*Sqrt[a + x*(b + c*x)])/c + (4*Sqrt[-(c*d^2) + b*d*e - a*e^2]*(e*f - d*g)^2*ArcTan[(Sqrt[c]*(d + e*x)
 - e*Sqrt[a + x*(b + c*x)])/Sqrt[-(c*d^2) + e*(b*d - a*e)]])/(c*d^2 + e*(-(b*d) + a*e)) - (g*(-4*c*e*f + 2*c*d
*g + b*e*g)*ArcTanh[(b + 2*c*x)/(2*Sqrt[c]*Sqrt[a + x*(b + c*x)])])/c^(3/2))/(2*e^2)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 259, normalized size of antiderivative = 1.47

method result size
risch \(\frac {g^{2} \sqrt {c \,x^{2}+b x +a}}{c e}-\frac {\frac {g \left (b e g +2 c d g -4 c e f \right ) \ln \left (\frac {\frac {b}{2}+c x}{\sqrt {c}}+\sqrt {c \,x^{2}+b x +a}\right )}{e \sqrt {c}}+\frac {2 \left (d^{2} g^{2}-2 d e f g +e^{2} f^{2}\right ) c \ln \left (\frac {\frac {2 e^{2} a -2 b d e +2 c \,d^{2}}{e^{2}}+\frac {\left (b e -2 c d \right ) \left (x +\frac {d}{e}\right )}{e}+2 \sqrt {\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}\, \sqrt {\left (x +\frac {d}{e}\right )^{2} c +\frac {\left (b e -2 c d \right ) \left (x +\frac {d}{e}\right )}{e}+\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}}{x +\frac {d}{e}}\right )}{e^{2} \sqrt {\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}}}{2 e c}\) \(259\)
default \(-\frac {g \left (\frac {d g \ln \left (\frac {\frac {b}{2}+c x}{\sqrt {c}}+\sqrt {c \,x^{2}+b x +a}\right )}{\sqrt {c}}-\frac {2 e f \ln \left (\frac {\frac {b}{2}+c x}{\sqrt {c}}+\sqrt {c \,x^{2}+b x +a}\right )}{\sqrt {c}}-e g \left (\frac {\sqrt {c \,x^{2}+b x +a}}{c}-\frac {b \ln \left (\frac {\frac {b}{2}+c x}{\sqrt {c}}+\sqrt {c \,x^{2}+b x +a}\right )}{2 c^{\frac {3}{2}}}\right )\right )}{e^{2}}-\frac {\left (d^{2} g^{2}-2 d e f g +e^{2} f^{2}\right ) \ln \left (\frac {\frac {2 e^{2} a -2 b d e +2 c \,d^{2}}{e^{2}}+\frac {\left (b e -2 c d \right ) \left (x +\frac {d}{e}\right )}{e}+2 \sqrt {\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}\, \sqrt {\left (x +\frac {d}{e}\right )^{2} c +\frac {\left (b e -2 c d \right ) \left (x +\frac {d}{e}\right )}{e}+\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}}{x +\frac {d}{e}}\right )}{e^{3} \sqrt {\frac {e^{2} a -b d e +c \,d^{2}}{e^{2}}}}\) \(301\)

[In]

int((g*x+f)^2/(e*x+d)/(c*x^2+b*x+a)^(1/2),x,method=_RETURNVERBOSE)

[Out]

g^2*(c*x^2+b*x+a)^(1/2)/c/e-1/2/e/c*(g*(b*e*g+2*c*d*g-4*c*e*f)/e*ln((1/2*b+c*x)/c^(1/2)+(c*x^2+b*x+a)^(1/2))/c
^(1/2)+2*(d^2*g^2-2*d*e*f*g+e^2*f^2)*c/e^2/((a*e^2-b*d*e+c*d^2)/e^2)^(1/2)*ln((2*(a*e^2-b*d*e+c*d^2)/e^2+(b*e-
2*c*d)/e*(x+d/e)+2*((a*e^2-b*d*e+c*d^2)/e^2)^(1/2)*((x+d/e)^2*c+(b*e-2*c*d)/e*(x+d/e)+(a*e^2-b*d*e+c*d^2)/e^2)
^(1/2))/(x+d/e)))

Fricas [F(-1)]

Timed out. \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\text {Timed out} \]

[In]

integrate((g*x+f)^2/(e*x+d)/(c*x^2+b*x+a)^(1/2),x, algorithm="fricas")

[Out]

Timed out

Sympy [F]

\[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\int \frac {\left (f + g x\right )^{2}}{\left (d + e x\right ) \sqrt {a + b x + c x^{2}}}\, dx \]

[In]

integrate((g*x+f)**2/(e*x+d)/(c*x**2+b*x+a)**(1/2),x)

[Out]

Integral((f + g*x)**2/((d + e*x)*sqrt(a + b*x + c*x**2)), x)

Maxima [F(-2)]

Exception generated. \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((g*x+f)^2/(e*x+d)/(c*x^2+b*x+a)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume((b/e-(2*c*d)/e^2)^2>0)', see `
assume?` for

Giac [F(-2)]

Exception generated. \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate((g*x+f)^2/(e*x+d)/(c*x^2+b*x+a)^(1/2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Error: Bad Argument Type

Mupad [F(-1)]

Timed out. \[ \int \frac {(f+g x)^2}{(d+e x) \sqrt {a+b x+c x^2}} \, dx=\int \frac {{\left (f+g\,x\right )}^2}{\left (d+e\,x\right )\,\sqrt {c\,x^2+b\,x+a}} \,d x \]

[In]

int((f + g*x)^2/((d + e*x)*(a + b*x + c*x^2)^(1/2)),x)

[Out]

int((f + g*x)^2/((d + e*x)*(a + b*x + c*x^2)^(1/2)), x)